<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <style>
        img {
            width: 300px;
        }
    </style>
    </head>

    <body>
        <img src="img/早上好.gif" alt="">
        <div>上午好</div>
        <script>
            /* 
                分析需求：
                    1. 根据不同的时间，显示不同图片和div的内容
            */

            let hour = prompt('请问几点了?');
            let img = document.querySelector('img');
            let div = document.querySelector('div');
            if (hour < 10) {
                img.src = "img/早上好.gif";
                div.innerHTML = '早上好';
            } else if (hour <= 13) {
                img.src = "img/下午好.gif";
                div.innerHTML = '下午好';
            } else {
                img.src = "img/晚上好.gif";
                div.innerHTML = '晚上好';
            }
        </script>
    </body>

</html>